<?php
header("Content-Type:json/html;charset=utf8;");

$config = require '../config.php';

$conn = new mysqli($config['servername'], $config['username'], $config['password'], $config['dbname']);
$sql = "select article.*,c.category from article,category as c where c.id = article.category_id order by isTop desc ";
$result = $conn->query($sql);
$conn->close();

$data = array();
while ($row = $result->fetch_assoc())
{
    $data[] = $row;
}
$result = ['code' =>1, 'data' => $data,  'msg' => "获取文章列表成功!"];
print_r(json_encode($result));
